﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.WebPages;
using System.Text;
using System.Reflection;
using System.IO;

namespace MTO.Library.Web
{
    public static class HtmlHelpersExtensions
    {
        public static string GetCurrentTheme(this HtmlHelper html)
        {
            var themeCookie = html.ViewContext.HttpContext.Request.Cookies.Get("theme");
            return themeCookie != null ? themeCookie.Value : "vista";
        }

        public static IEnumerable<string> GetAllThemesName(this HtmlHelper html)
        {
            string telerikCSSPath = html.ViewContext.HttpContext.Server.MapPath("Content/Telerik");
            var telerikCSSThemeNames = Directory.GetDirectories(telerikCSSPath);

            return telerikCSSThemeNames.Select(x => Path.GetFileName(x));
        }
    }
}